/*
 * @Author: szx
 * @Date: 2022-01-02 12:43:05
 * @LastEditTime: 2022-01-02 13:51:43
 * @Description:
 * @FilePath: \leetcode\300-399\390\390.js
 */
/**
 * @param {number} n
 * @return {number}
 */
var lastRemaining = function (n) {
    if (n == 1) return 1;
    else return 2 * (n / 2 + 1 - lastRemaining(n / 2));
};
